package com.hanbang.gycatering.adpater;

import java.util.List;

import com.hanbang.gangyu.R;
import com.hanbang.gycatering.bean.PropertyBeanData;
import com.hanbang.gycatering.utils.MyLog;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class PropertyAdapter extends BaseAdapter {
	PropertyBeanData entity;
	ViewHolder viewHolder;
	Bitmap bit;
 
	private List<PropertyBeanData> coll;
	private LayoutInflater mInflater;
	private Context context;

	public PropertyAdapter(Context context, List<PropertyBeanData> coll) {
		this.coll = coll;
		mInflater = LayoutInflater.from(context);
		this.context = context;
	}

	public void addLiuYanAdapter(List<PropertyBeanData> colls) {
		this.coll = colls;
	}

	public int getCount() {
		return coll.size();
	}

	public Object getItem(int position) {
		return coll.get(position);
	}

	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		MyLog.e("getView", position+"");
		ViewHolder holder = null;
		PropertyBeanData data = coll.get(position);
		if (convertView == null) {
			holder = new ViewHolder();
			convertView = mInflater.inflate(
					R.layout.item_property, null);
			holder.title = (TextView) convertView
					.findViewById(R.id.item_left);
			holder.time = (TextView) convertView
					.findViewById(R.id.item_right);
			 
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
	 
		holder.title.setText(data.getTitle());
		holder.time.setText(data.getTime());
		return convertView;
	}

	private class ViewHolder {
		TextView title = null;
		TextView time = null;
	}
}

